<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../resources/home/css/css.css" rel="stylesheet" type="text/css" />
<link href="../resources/home/css/common.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="../resources/admin/easyui/easyui/1.3.4/themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="../resources/admin/easyui/css/wu.css" />
<link rel="stylesheet" type="text/css" href="../resources/admin/easyui/css/icon.css" />
<script src="../resources/home/js/jquery-1.9.1.min.js" type="text/javascript"></script>
<script src="../resources/home/js/jquery.SuperSlide.2.1.1.js" type="text/javascript"></script>
<script src="../resources/home/js/common_js.js" type="text/javascript"></script>
<script type="text/javascript" src="../resources/admin/easyui/js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="../resources/admin/easyui/easyui/1.3.4/jquery.easyui.min.js"></script>
<script type="text/javascript" src="../resources/admin/easyui/easyui/1.3.4/locale/easyui-lang-zh_CN.js"></script>
<title>用户注册</title>
</head>
<script type="text/javascript">
function changeCpacha(){
	$("#cpacha-img").attr("src",'/TeaShop/system/get_cpacha?vl=4&w=150&h=40&type=registerCpacha&t=' + new Date().getTime());
}

function submitRegister()
{
	if($("#username").val() == ''){
		$.messager.alert("消息提醒", "用户名不能为空!", "warning");
		return;
	}
	if($("#realname").val() == ''){
		$.messager.alert("消息提醒", "真实姓名不能为空!", "warning");
		return;
	}
	if($("#password").val() == ''){
		$.messager.alert("消息提醒", "密码不能为空!", "warning");
		return;
	}
	if($("#confirm_password").val() == ''){
		$.messager.alert("消息提醒", "确认密码不能为空!", "warning");
		return;
	}
	if($("#phone").val() == ''){
		$.messager.alert("消息提醒", "电话不能为空!", "warning");
		return;
	}
	if($("#email").val() == ''){
		$.messager.alert("消息提醒", "电子邮箱不能为空!", "warning");
		return;
	}
	if($("#cpacha").val() == ''){
		$.messager.alert("消息提醒", "验证码不能为空!", "warning");
		return;
	}
	
	var data = $("#register_form").serialize();
	$.ajax({
		type: "post",
		url: "/TeaShop/home/add",
		data: data, 
		dataType: "json", //返回数据类型
		success: function(result){
			if(result.type == 'success'){
				$.messager.confirm("消息提醒", "注册成功！是否跳转到首页登录？", function (data) {
		            if (data) {
		            	window.location.href = "/TeaShop/home/system/index";
		            }
		            else {
		            	changeCpacha();
		            }
		        });
			}
			else{
				$.messager.alert("消息提醒", result.msg, "warning");
				changeCpacha();
			}
			
		}
		
	});
	
	
}


</script>
<body>
<!--顶部样式-->
<div class="common_top">
 <div class="Narrow">
  <div class=" left logo"><a href="/TeaShop/home/system/index"><img src="../resources/home/images/logo.png" /></a></div>
  <!--电话图层-->
  <div class="phone"><label>全国服务热线：</label><em>400-345-5633</em></div>
 </div>
</div>
<!--用户注册样式-->
<div class="registered_style Narrow clearfix">
   <div class="left_advertising">
    <img src="../resources/home/images/bg_03.png" />
   </div>
   <div class="right_register">
     <div class="register_Switching" id="register_Switching">
       <div class="hd">
        <ul><li>注册用户</li></ul>
       </div>
       <div class="bd">
        <ul>
            <form id="register_form"  method="post" > 
			   	<div class="form clearfix">	
			    <div class="item"><label class="rgister-label">用&nbsp;&nbsp;户&nbsp;&nbsp;名：</label><input id="username" name="username" type="text"  class="text" /><b>*</b></div>
				 <div class="item"><label class="rgister-label" >真实姓名：</label><input id="realname" name="realname" type="text"  class="text" p/><b>*</b></div> 
				<div class="item"><label class="rgister-label" >密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码：</label><input id="password" name="password" type="password"  class="text" /><b>*</b></div> 
			
				<div class="item"><label class="rgister-label " >确认密码：</label><input id="confirm_password" name="confirm_password" type="password"  class="text" /><b>*</b></div>
			     
			   <div class="item"><label class="rgister-label" >电&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;话：</label><input id="phone" name="phone" type="text"  class="easyui-numberbox"  data-options="min:0,precision:0" /><b>*</b></div> 
			    <div class="item"><label class="rgister-label" >电子邮箱：</label><input id="email" name="email" type="text"  class="text" /><b>*</b></div> 
			 
			    <div class="item "><label  class="rgister-label ">验&nbsp;证&nbsp;码：</label><input id="cpacha" name="cpacha" type="text" style="width:110px" class="Recommend_text" />
		    		<img id="cpacha-img" title="点击切换验证码" style="cursor:pointer;margin-bottom:-14px" src="/TeaShop/system/get_cpacha?vl=4&w=150&h=45&type=registerCpacha"  width="110px" height="35px" onclick="changeCpacha()">
			    </div>
			  </div>	
			  <div class="rgister-btn">
			  <a href="javascript:;" onclick="submitRegister();" class="btn_rgister">注&nbsp;&nbsp;&nbsp;&nbsp;册</a>
			  </div>
			  <div class="Note"><span class="login_link">已有账户<a href="/TeaShop/home/login">请登录</a></span></div>	  
	  		</form>
        </ul>
       </div>
     </div>
    
    </div>
</div>
<!--底部样式-->
 <div class="bottom_footer">
  
	 <p>Copyright©2014苏珊荔枝有限公司.All Rights Reserved. </p>
	 <p>粤ICP备09150084号</p>
   </div>
</body>
</html>
